home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / games / IndiZone / blix / maze.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.3 KB  |  124 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*_________________________________________________________________________
  18.  |
  19.  | maze.h - maze creation and drawing routines
  20.  |
  21.  |     (c) 1994 Frans van Hoesel, Xtreme graphics software
  22.  |
  23. */
  24.  
  25. #ifndef MAZE_H__SEEN
  26.  
  27. /* included for definition of type object */
  28. #include <gl/gl.h>
  29.  
  30. #include "config.h"
  31. #include "players.h"
  32.  
  33. #define MAXHEIGHT 0.08
  34. #define WIDTH 0.02
  35. #define DEPTH 20
  36. /* I define some fp constants extra, because I'm not sure if the
  37.  * preprocessor would do that for me. The old one did not
  38.  */
  39. #define FOVY 100     /* angle of perspective view in 1/10 degrees */
  40. #define TANFOVY 0.087    /* tan(FOVY/20) */
  41. #define SCALE 1.0    /* fixed scaling, sphere is unit size before scaling */
  42. #define TANFOVY_BY_SCALE 0.087 /* TANFOVY / SCALE */
  43. #define TRANS (-14)     /* 1.0 / TANFOVY ; initial translation */
  44. #define NEAR 0.15    /* clipping plane; far is determined by trans */
  45. #define EXTRA 0.377705  /* sqrt(1.0 - 1/SQR(1+MAXHEIGHT)) */
  46. #define PI_DEPTH 0.157079632 /* PI / DEPTH */
  47.  
  48. typedef struct {
  49.     float w0[3];
  50.     float w1[3];
  51.     float w2[3];
  52.     float w3[3];
  53.     float n0[3];
  54.     float n1[3];
  55.     float n2[3];
  56. } segment_t;
  57.  
  58.  
  59. typedef struct {
  60.     Object wall_obj;            /* side of the walls */
  61.     Object top_obj;            /* top of the walla */
  62. } arc_t;
  63.  
  64. typedef struct {
  65.     int narcs;
  66.     arc_t *arcs;
  67.     float *walls;        /* holds lengths of the walls */
  68.     float *gaps;        /* holds lengths of the gaps */
  69.     float start[3];            /* starting point of circle */
  70.     int *cappings;            /* wall has ends or not */
  71.     float rotation;        /* overall rotation */
  72.     float cradius;            /* cartesian radius */
  73. } circle_t;
  74.  
  75. typedef struct {
  76.     int ncircles;
  77.     circle_t *circles;
  78.     float center_v[3];        /* coordinates of center */
  79.     float axis_v[3];
  80.     float radius;            /* cartesian maximum radius */
  81. } center_t;
  82.  
  83.  
  84. typedef union special_t {
  85.     struct b /*bits */ {
  86.     unsigned int ptype : 4;
  87.     unsigned int ndir : 1;
  88.     unsigned int magic : 16;
  89.     } b;
  90.     int all;
  91. } special_t;
  92.  
  93. typedef struct node_t {
  94.     float pos[3];
  95.     int    cnt;                /* number of connnection */
  96.     player_t *player;
  97.     special_t special;
  98.     int c[4];            /* connections to other nodes */
  99. } node_t;
  100.  
  101. typedef struct {
  102.     int ncenters;
  103.     int leveln;            /* the level number */
  104.     center_t *centers;
  105.     int nnodes;
  106.     node_t *nodes;
  107. } level_t;
  108.  
  109. typedef struct {
  110.     int nlevels;
  111.     level_t *levels;
  112. } maze_t;
  113.  
  114. void init_maze(void);
  115. void build_maze(int level, int lod) ;
  116. void draw_maze(const Matrix m, int zbuf) ;
  117. void free_arcs(void);
  118. #ifdef BUILDNODES
  119. void write_nodes(void);
  120. #endif
  121.  
  122. #define MAZE_H__SEEN
  123. #endif
  124.